package P3244;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Problema da disciplina de Estrutura de Dados e Complexidade de Algoritmos da
 * Pos Graduacao do Periodo 2011.1
 *
 * @see http://br.spoj.pl/problems/NLOGONIA/
 * @author Elenilson Vieira - 111100371 - elenilson[at]elenilsonvieira.com
 * @since 23 de marco de 2011
 */
public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        while (true) {
            int queries = Integer.parseInt(reader.readLine().trim());

            if(queries == 0)
                break;

            int coordinates[] = readCoordinates(reader);
            int dividingPointX = coordinates[0];
            int dividingPointY = coordinates[1];

            for (int i = 0; i < queries; i++) {
                coordinates = readCoordinates(reader);
                int x = coordinates[0];
                int y = coordinates[1];

                if (y == dividingPointY || x == dividingPointX) {
                    System.out.println("divisa");
                } else if (y < dividingPointY) {
                    if (x < dividingPointX) {
                        System.out.println("SO");
                    } else {
                        System.out.println("SE");
                    }
                } else {
                    if (x < dividingPointX) {
                        System.out.println("NO");
                    } else {
                        System.out.println("NE");
                    }
                }
            }
        }
    }

    private static int[] readCoordinates(BufferedReader reader) throws IOException {
        String coordinates[] = reader.readLine().split(" ");
        return new int[]{Integer.parseInt(coordinates[0]), Integer.parseInt(coordinates[1])};
    }
}
